function mask = nonzero_mask(matrix)
sizem = size(matrix);
widthm = sizem(1);
mask = ones(sizem);
% suppose its square matrix;
for i=1:widthm
    for j=1:widthm
        if isempty(symvar(matrix(i,j)))
            mask(i,j) = 0;
        end
    end
end
end